<?php

namespace Application\Model\abonnement;
use Zend\InputFilter\Factory as InputFactory;
use Zend\InputFilter\InputFilter;
use Zend\InputFilter\InputFilterAwareInterface;
use Zend\InputFilter\InputFilterInterface;

class Abonnement implements InputFilterAwareInterface{
	
	private $email;
	private $action;
	protected $inputFilter;
	
	public function exchangeArray($data)
	{
		$this->email       = (isset($data['email'])) ? $data['email'] : null;
		$this->action      = (isset($data['action'])) ? $data['action'] : null;
		
	
	}
	
	public function getArrayCopy()
	{
		return get_object_vars($this);
	}
	
	public function setInputFilter(InputFilterInterface $inputFilter)
	{
		throw new \Exception("Not used");
	}
	
	public function getInputFilter()
	{
		if (!$this->inputFilter) {
				
			$inputFilter = new InputFilter();
			$factory     = new InputFactory();
	
		
			$inputFilter->add($factory->createInput(array(
			 'name'     => 'sexe',
					'validators' => array(
							array(
									'name'    => 'InArray',
									'options' => array(
											'haystack' => array(2,3),
											'messages' => array(
													'notInArray' => 'Please select your action !'
											),
									),
							),
					),
			)));
	
			
	
			$inputFilter->add($factory->createInput(array(
					'name'     => 'email',
					'required' => true,
					'validators' => array(
							array(
									'name'    => 'EmailAddress'
							),
					),
			)));

			$this->inputFilter = $inputFilter;
		}
	
		return $this->inputFilter;
	}
}

?>